<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Author extends Model
{
    protected $fillable = ['article_id', 'firstname', 'lastname', 'email', 'correspondence', 'affiliation' , 'created_at', 'updated_at'];
    protected $table='authors';

    public function Article()
    {
        return $this->belongsTo(Article::class);
    }

    public function getName()
    {
    	return $this->firstname . ' ' . ($this->middlename ? $this->middlename . ' ' : '') . $this->lastname;
    }
}
